(function(c, n) {
    var k = "";
    c.fn.imagesLoaded = function(l) {
        function m() {
            var b = c(h), a = c(g);
            d && (g.length ? d.reject(e, b, a) : d.resolve(e));
            c.isFunction(l) && l.call(f, e, b, a)
        }
        function i(b, a) {
            b.src === k || -1 !== c.inArray(b, j) || (j.push(b), a ? g.push(b) : h.push(b), c.data(b, "imagesLoaded", {isBroken: a, src: b.src}), o && d.notifyWith(c(b), [a, e, c(h), c(g)]), e.length === j.length && (setTimeout(m), e.unbind(".imagesLoaded")))
        }
        var f = this, d = c.isFunction(c.Deferred) ? c.Deferred() :
                0, o = c.isFunction(d.notify), e = f.find("img").add(f.filter("img")), j = [], h = [], g = [];
        e.length ? e.bind("load.imagesLoaded error.imagesLoaded", function(b) {
            i(b.target, "error" === b.type)
        }).each(function(b, a) {
            var e = a.src, d = c.data(a, "imagesLoaded");
            if (d && d.src === e)
                i(a, d.isBroken);
            else if (a.complete && a.naturalWidth !== n)
                i(a, 0 === a.naturalWidth || 0 === a.naturalHeight);
            else if (a.readyState || a.complete)
                a.src = k, a.src = e
        }) : m();
        return d ? d.promise(f) : f
    }
})(jQuery);
